# -*- coding: utf-8 -*-
"""
@Time ： 2022/7/19 20:56
@Auth ： Mr. William 1052949192
@Company ：特斯汀学院 @testingedu.com.cn
@Function ：正则
"""
import re
#
# my_html = """
# <html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta content="always" name="referrer"><meta name="theme-color" content="#ffffff"><meta name="description" content="全球领先的中文搜索引擎、致力于让网民更便捷地获取信息，找到所求。百度超过千亿的中文网页数据库，可以瞬间找到相关的搜索结果。"><link rel="shortcut icon" href="
# 	/favicon.ico
# 	" type="image/x-icon" /><link rel="search" type="application/opensearchdescription+xml" href="/content-search.xml
# 	" title="百度搜索" /><link rel="icon" sizes="any" maskhref="//www.baidu.com/img/baidu_85beaf5496f291521eb75ba38eacbd87.svg
# 	"><link rel="dns-prefetch" href="//dss0.bdstatic.com
# 	"/><link rel="dns-prefetch" href="//dss1.bdstatic.com
# 	"/><link rel="dns-prefetch" href="//ss1.bdstatic.com
# 	"/><link rel="dns-prefetch" href="//sp0.baidu.com
# 	"/><link rel="dns-prefetch" href="//sp1.baidu.com
# 	"/><link rel="dns-prefetch" href="//sp2.baidu.com
# 	"/><title>百度一下，你就知道</title><style index="newi" type="text/css">
# 	<body>
# 	<div class="c-tips-container" id="c-tips-container"></div>
# 	<script>
# 	var s_session={
# 		"logId":"3614294667",
# 		"seqId":"3614294907",
# 		"sessionId":"",
# 		"debug":false,
# 		"userTips":"{}",
# 		"curmod":"2",
# 		"firstmod":"",
# 		"logoCode":false,
# 		"isFesLogo":false,
# 		"sid":"36454_34813_36422_36166_36488_36055_36419_26350_36299_36468_36315_36447",
# 		"mSid":"",
# 		"sample_value":"",
# 		"isLogin":false,
# 		"agingVoice": "",
# 		"卡卡": "632232258",
# 		"Will": "1052949192",
# 		"Phone": "18874922908"
# 	};
# 	window.__async_strategy = 2;
# 	</script>
# 	</body>
# 	</html>/>"""
#
# # 取两个字符串之间的内容：字符串1=' title="' 字符串2='" />'
# res = re.findall(r' title=(.*?)/>',my_html)
# print(res)
#
# # # 取json字符串
# # res = re.findall(r's_session=(.*);',my_html,re.S)
# # print(res)
# #
# # # 去掉空字符
# # print(re.sub(r'\s{2,}', '', res[0]))
# #
# # # 提取连续数字（大括号代表前面这个表达式匹配的次数
# # res = re.findall(r'[0-9]{5,8}',my_html)
# # print(res)
# #
# #
# # # 提取QQ号码
# # res = re.findall(r'[1-9][0-9]{7,10}',my_html)
# # print(res)
# #
# # # 提取手机号码
# # res = re.findall(r'1[3,9][0-9]{9}',my_html)
# # print(res)
# #
# # 提取link标签之间内容（贪心，匹配到最后一个结束符）
# res = re.findall(r'<link.*/>',my_html,re.S)
# print(res)

# print('#' * 10)
# # 提取link标签之间内容（非贪心，匹配到第一个结束就结束）
# res = re.findall(r'<link.*?/>',my_html,re.S)
# print(res)

s = "9123912391239a9213123139>"
# 提取link标签之间内容（贪心，匹配到最后一个结束符）
res = re.findall(r'9\d*?9',s)
print(res)


